package com.bite.principal.component;


import com.bite.principal.model.Dog;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class LifeCycle {
    private Dog dog;

    @Autowired
    public void setDog(@Qualifier("applicationDog") Dog dog) {
        log.info("autowired dog...");
        this.dog = dog;
    }

    @PostConstruct
    public void init() {
        log.info("init...");
    }


    @PreDestroy
    public void destroy() {
        log.info("destroy...");
    }

    public void show() {
        log.info("show dog {}", dog);
    }
}
